<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/business/supplier/template.xhtml"
>

	<f:metadata>
		<f:viewParam name="notificationId" value="#{notificationHome.id}"></f:viewParam>		
		<f:event listener="#{notificationHome.initConversation()}" type="preRenderView" />
		
	</f:metadata>
	<ui:define name="supplier_head">
		<h:outputStylesheet name="css/public/iconfont3.css" />
		<h:outputStylesheet name="css/public/first-pagemain.css" />
		<style type="text/css">
			.Methbox_con p {
			    font-size: 16px;
			    line-height: 30px;
			    text-indent: 0em;
			    color: #333333;
			    margin-bottom: 10px;
			}
			
		</style>
		
		<script>
			var hasRead = '#{notificationHome.instance.hasRead}';
			var id = '#{notificationHome.instance.id}';
			var url = "${request.getContextPath()}/rest/notification/setNotificationRead/"+id; 
			if(hasRead == 'false' ){
            	$.ajax({
                	
		    		type: "get",
		            contentType: "application/json; charset=utf-8",
		            dataType: "json",
		            url: url,  
		            async:false,
		            success: function (json) { 
		            	console.log(json);
		            },
		            timeout: 1000,
		            error: function (XMLHttpRequest, textStatus, errorThrown) {           
		            	alert('更新消息通知为已读出错！');
		            }
			    });		

			}

		</script>	
	</ui:define>
	<ui:define name="supplier_content">

		<h:form id="searchForm">
			<!--右侧我收到的项目邀请-->
			<div class="iethbox_tit">
				<h2>消息通知</h2>
			</div>
			<div class="Methbox_con">				
					<div class="sub_view">
						<h2>#{notificationHome.instance.titile}</h2>
						<div class="view_dem">
							<div class="fleft">
								<p:outputLabel value="发布人："></p:outputLabel>
								<span class="blue">
									<h:outputText value="系统管理员" />
								</span>
							</div>
							<div class="fright">
								<p:outputLabel value="发布日期："></p:outputLabel>							
								<h:outputText value="#{notificationHome.instance.sendDate}">
									<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
								</h:outputText>
							</div>
						</div>
					</div>
					<div class="articleContent">
						<h:outputText value="#{notificationHome.instance.content}" escape="false" />
					</div>
			</div>		
		</h:form>

	</ui:define>
</ui:composition>
